<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="步骤1：开启MySQL/MariaDB数据库权限">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="zh-cn_topic_0000001792343590.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect 备份一体机 1.5.0-1.6.0 帮助中心">
<meta name="DC.Publisher" content="20240320">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="ZH-CN_TOPIC_0000001839142693">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>步骤1：开启MySQL/MariaDB数据库权限</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="ZH-CN_TOPIC_0000001839142693"></a><a name="ZH-CN_TOPIC_0000001839142693"></a>

<h1 class="topictitle1">步骤1：开启MySQL/MariaDB数据库权限</h1>
<div><p>MySQL/MariaDB在执行备份任务前，需开启对应版本权限，否则会导致注册、备份或恢复失败。当前操作以MySQL 8.0.11数据库和openEuler 22.03操作系统为例，不同版本的命令可能会有差异，可联系运维人员或数据库管理员提供对应的命令。</p>
<div class="section"><h4 class="sectiontitle">操作步骤</h4><ol><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li188641010427"><span>使用root用户，登录MySQL/MariaDB主机，执行<strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b253942933412">mysql -uroot -p</strong><em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i14934102923410">Password</em>登录MySQL/MariaDB数据库。</span></li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li12801332115118"><span>执行<strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b1328393213513">CREATE USER '</strong><em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i1328333255118">name</em><strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b142831432115115">'@'</strong><strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b27081312638">127.0.0.1</strong><strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b11283113225110">' IDENTIFIED BY '</strong><em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i44353389320">password</em><strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b8283133245111">';</strong>命令创建用户。</span></li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li3310147525"><span>依次执行以下命令，开启MySQL/MariaDB数据库127.0.0.1的远程登录权限。</span><p><ol type="a" id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_ol173593501938"><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li4239141921418">执行<strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b11870950181220">G</strong><strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b1174351662913">RANT ALL PRIVILEGES ON *.* TO '</strong><em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i1730820172295">name</em><strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b11743101652915">'@'127.0.0.1'</strong><strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b20271890214"> WITH GRANT OPTION;</strong>命令，开启127.0.0.1的远程登录权限。</li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li10955327111418">执行<strong id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_b10660347151410">FLUSH PRIVILEGES;</strong>命令，刷新MySQL/MariaDB远程登录权限。</li></ol>
</p></li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li1031195615112"><span>执行以下命令为用户开启相应数据库版本权限。</span><p><ul id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_ul0622182323520"><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li26227234359">MySQL 5.x：<pre class="screen" id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_screen5134135312354">GRANT RELOAD, PROCESS, REPLICATION CLIENT, SUPER, LOCK TABLES  ON *.* TO '<em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i044813363">name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li262215238353">MySQL 8.x：<pre class="screen" id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_screen1829411173364">GRANT BACKUP_ADMIN, SELECT, RELOAD, PROCESS, SUPER, LOCK TABLES  ON *.* TO '<em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i31132289360">name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li46228239353">MariaDB 10.5/10.6/10.7：<pre class="screen" id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_screen186673053617">GRANT RELOAD, PROCESS, BINLOG MONITOR, SUPER, LOCK TABLES ON *.* TO '<em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i77531146193610">name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li1862314236351">MariaDB 10.3/10.4：<pre class="screen" id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_screen153740491365">GRANT RELOAD, PROCESS, REPLICATION CLIENT, SUPER, LOCK TABLES ON *.* TO '<em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i2962200163714">name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_li106231723113511">MariaDB 10.2：<pre class="screen" id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_screen17113103717">GRANT USAGE ON *.* TO '<em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i8577816193720">name2</em>'@'127.0.0.1' IDENTIFIED BY '<em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i5577161663715">password</em>';
GRANT RELOAD,PROCESS,SUPER,REPLICATION CLIENT,LOCK TABLES ON *.* TO '<em id="ZH-CN_TOPIC_0000001839142693__zh-cn_topic_0000001497361525_i558011615371">name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li></ul>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>父主题：</strong> <a href="zh-cn_topic_0000001792343590.html">备份MySQL/MariaDB数据库</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>